﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;


namespace QuizSilverlight.Web.Administration
{
    public partial class RetreiveQuestions : System.Web.UI.Page
    {
        private QuizDataClassesDataContext quizzDC = new QuizDataClassesDataContext();

        protected void Page_Load(object sender, EventArgs e)
        {

            /*var groupJoinQuery1 =
            from question in quizzDC.Questions
            from answer in quizzDC.Answers
            where question.Id_Question == answer.Id_Question
           
            orderby answer.Body
            select new
            {
                Questions = question.Body,

                Answers = answer.Body
                                      

            } ;*/

            var result = from question in quizzDC.Question
                         join answer in quizzDC.Answer

                         on question.Id_Question equals answer.Id_Question

                         select new { Questions = question.Body, Answers = answer.Body };


            GridView1.DataSource = result.ToList();
            GridView1.DataBind();

        }






    }
}